<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>面试结果 - SimpleHire AI面试系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        .result-container {
            max-width: 1000px;
            margin: 2rem auto;
            padding: 0 1rem;
        }
        .result-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            overflow: hidden;
            margin-bottom: 2rem;
        }
        .result-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 2rem;
            text-align: center;
        }
        .score-circle {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 1rem;
            font-size: 2.5rem;
            font-weight: bold;
        }
        .result-body {
            padding: 2rem;
        }
        .question-card {
            background: #f8f9fa;
            border-radius: 15px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            border-left: 5px solid #667eea;
        }
        .answer-card {
            background: #e3f2fd;
            border-radius: 15px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            border-left: 5px solid #2196f3;
        }
        .evaluation-card {
            background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
            border-radius: 15px;
            padding: 2rem;
            margin-bottom: 2rem;
            border: 1px solid #4caf50;
        }
        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 10px;
            padding: 0.75rem 2rem;
            font-weight: 600;
            transition: all 0.3s ease;
        }
        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
        }
        .btn-secondary {
            border-radius: 10px;
            padding: 0.75rem 2rem;
            font-weight: 600;
        }
        .badge {
            font-size: 0.9rem;
            padding: 0.5rem 1rem;
            border-radius: 20px;
        }
        .score-excellent {
            background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
            color: white;
        }
        .score-good {
            background: linear-gradient(135deg, #2196f3 0%, #03a9f4 100%);
            color: white;
        }
        .score-average {
            background: linear-gradient(135deg, #ff9800 0%, #ffc107 100%);
            color: white;
        }
        .score-poor {
            background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
            color: white;
        }
        .info-item {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
        }
        .info-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1rem;
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark" style="background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px);">
        <div class="container">
            <a class="navbar-brand fw-bold" href="/">
                <i class="bi bi-robot me-2"></i>SimpleHire AI
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="/interview">
                            <i class="bi bi-chat-dots me-1"></i>开始面试
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="/interview/history">
                            <i class="bi bi-clock-history me-1"></i>面试历史
                        </a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown" sec:authorize="isAuthenticated()">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle me-1"></i>
                            <span sec:authentication="name">用户</span>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a class="dropdown-item" href="/profile">
                                <i class="bi bi-person me-2"></i>个人资料
                            </a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li>
                                <form th:action="@{/logout}" method="post" class="d-inline">
                                    <button type="submit" class="dropdown-item">
                                        <i class="bi bi-box-arrow-right me-2"></i>退出登录
                                    </button>
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="result-container">
        <!-- 面试结果卡片 -->
        <div class="result-card">
            <!-- 结果头部 -->
            <div class="result-header">
                <div class="score-circle" th:classappend="${result.score >= 90} ? 'score-excellent' : (${result.score >= 75} ? 'score-good' : (${result.score >= 60} ? 'score-average' : 'score-poor'))">
                    <span th:text="${result.score} + '分'">85分</span>
                </div>
                <h2 class="mb-2">面试评估完成</h2>
                <p class="mb-0 opacity-75" th:text="${#temporals.format(result.createdAt, 'yyyy-MM-dd HH:mm')}">2024-01-01 12:00</p>
            </div>

            <div class="result-body">
                <!-- 面试信息 -->
                <div class="row mb-4">
                    <div class="col-md-6">
                        <div class="info-item">
                            <div class="info-icon">
                                <i class="bi bi-calendar"></i>
                            </div>
                            <div>
                                <strong>面试时间</strong><br>
                                <span class="text-muted" th:text="${#temporals.format(result.createdAt, 'yyyy-MM-dd HH:mm')}">2024-01-01 12:00</span>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="info-item">
                            <div class="info-icon">
                                <i class="bi bi-trophy"></i>
                            </div>
                            <div>
                                <strong>综合评分</strong><br>
                                <span class="badge" th:classappend="${result.score >= 90} ? 'score-excellent' : (${result.score >= 75} ? 'score-good' : (${result.score >= 60} ? 'score-average' : 'score-poor'))" th:text="${result.score} + '分'">85分</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- AI评估 -->
                <div class="evaluation-card" th:if="${result.aiEvaluation}">
                    <h5 class="mb-3">
                        <i class="bi bi-robot me-2"></i>AI 综合评估
                    </h5>
                    <div class="evaluation-content" th:utext="${#strings.replace(result.aiEvaluation, '\n', '<br>')}">AI评估内容</div>
                </div>

                <!-- 面试问题和答案 -->
                <h5 class="mb-3">
                    <i class="bi bi-chat-dots me-2"></i>面试问答详情
                </h5>
                
                <div th:each="question, iterStat : ${questions}" class="mb-4">
                    <div class="question-card">
                        <h6 class="mb-2">
                            <i class="bi bi-question-circle me-2"></i>
                            问题 <span th:text="${iterStat.index + 1}">1</span>
                        </h6>
                        <p class="mb-0" th:text="${question}">面试问题内容</p>
                    </div>
                    
                    <div class="answer-card" th:if="${answers != null and iterStat.index < answers.size()}">
                        <h6 class="mb-2">
                            <i class="bi bi-chat-left-text me-2"></i>
                            您的回答
                        </h6>
                        <p class="mb-0" th:text="${answers[iterStat.index]}">用户回答内容</p>
                    </div>
                </div>

                <!-- 操作按钮 -->
                <div class="d-grid gap-2 d-md-flex justify-content-md-center mt-4">
                    <a href="/interview" class="btn btn-primary me-md-2">
                        <i class="bi bi-arrow-repeat me-2"></i>重新面试
                    </a>
                    <a href="/interview/history" class="btn btn-secondary me-md-2">
                        <i class="bi bi-clock-history me-2"></i>查看历史
                    </a>
                    <button class="btn btn-outline-primary" onclick="window.print()">
                        <i class="bi bi-printer me-2"></i>打印结果
                    </button>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // 页面加载完成后的动画效果
        document.addEventListener('DOMContentLoaded', function() {
            const cards = document.querySelectorAll('.result-card, .question-card, .answer-card, .evaluation-card');
            cards.forEach((card, index) => {
                card.style.opacity = '0';
                card.style.transform = 'translateY(20px)';
                setTimeout(() => {
                    card.style.transition = 'all 0.5s ease';
                    card.style.opacity = '1';
                    card.style.transform = 'translateY(0)';
                }, index * 100);
            });
        });
    </script>
</body>
</html>